﻿/*
 * Created by SharpDevelop.
 * User: amb
 * Date: 05/06/2014
 * Time: 80:33
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;

namespace JdFormsDll
{
    public class MyFormRenderer : ToolStripProfessionalRenderer
    {
        public MyFormRenderer()
            : base(new MyFormProfessionalColorTable())
        {
            this.RoundedEdges = false;
        }
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            Form f = e.ToolStrip.FindForm();
            if (f != null) Table.Form = (MyForm)f;
            base.OnRenderToolStripBackground(e);
        }
        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            Form f = e.ToolStrip.FindForm();
            if (f != null) Table.Form = (MyForm)f;
            e.Item.ForeColor = Table.ForeColor(e.Item.BackColor);
            base.OnRenderItemText(e);
        }
        protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
        {
            base.OnRenderToolStripBorder(e);
            if (e.ToolStrip is MyFormStatusStrip)
            {
                e.Graphics.DrawLine
                    (
                    new Pen(Table.BorderColor(e.BackColor), 1),
                    e.AffectedBounds.Left,
                    e.AffectedBounds.Top,
                    e.AffectedBounds.Right,
                    e.AffectedBounds.Top
                    );
            }  
        }
    }

    public class MyFormProfessionalColorTable : ProfessionalColorTable
    {
        public override Color ButtonCheckedGradientBegin
        {
            get { return Table.BackColorSelected(base.ButtonCheckedGradientBegin); }
        }
        public override Color ButtonCheckedGradientEnd
        {
            get { return Table.BackColorSelected(base.ButtonCheckedGradientEnd); }
        }
        public override Color ButtonCheckedGradientMiddle
        {
            get { return Table.BackColorSelected(base.ButtonCheckedGradientMiddle); }
        }
        public override Color ButtonCheckedHighlight
        {
            get { return Table.BackColorSelected(base.ButtonCheckedHighlight); }
        }
        public override Color ButtonCheckedHighlightBorder
        {
            get { return Table.BorderColor(base.ButtonCheckedHighlightBorder); }
        }
        public override Color ButtonPressedBorder
        {
            get { return Table.BorderColor(base.ButtonPressedBorder); }
        }
        public override Color ButtonPressedGradientBegin
        {
            get { return Table.BackColorPressed(base.ButtonPressedGradientBegin); }
        }
        public override Color ButtonPressedGradientEnd
        {
            get { return Table.BackColorPressed(base.ButtonPressedGradientEnd); }
        }
        public override Color ButtonPressedGradientMiddle
        {
            get { return Table.BackColorPressed(base.ButtonPressedGradientMiddle); }
        }
        public override Color ButtonPressedHighlight
        {
            get { return Table.BackColorPressed(base.ButtonPressedHighlight); }
        }
        public override Color ButtonPressedHighlightBorder
        {
            get { return Table.BorderColor(base.ButtonPressedHighlightBorder); }
        }
        public override Color ButtonSelectedBorder
        {
            get { return Table.BorderColor(base.ButtonSelectedBorder); }
        }
        public override Color ButtonSelectedGradientBegin
        {
            get { return Table.BackColorSelected(base.ButtonSelectedGradientBegin); }
        }
        public override Color ButtonSelectedGradientEnd
        {
            get { return Table.BackColorSelected(base.ButtonSelectedGradientEnd); }
        }
        public override Color ButtonSelectedGradientMiddle
        {
            get { return Table.BackColorSelected(base.ButtonSelectedGradientMiddle); }
        }
        public override Color ButtonSelectedHighlight
        {
            get { return Table.BackColorSelected(base.ButtonSelectedHighlight); }
        }
        public override Color ButtonSelectedHighlightBorder
        {
            get { return Table.BorderColor(base.ButtonSelectedHighlightBorder); }
        }
        public override Color CheckBackground
        {
            get { return Table.BackColor(base.CheckBackground); }
        }
        public override Color CheckPressedBackground
        {
            get { return Table.BackColorPressed(base.CheckPressedBackground); }
        }
        public override Color CheckSelectedBackground
        {
            get { return Table.BackColorSelected(base.CheckSelectedBackground); }
        }
        public override Color GripDark
        {
            get { return Table.BackColor(base.GripDark); }
        }
        public override Color GripLight
        {
            get { return Table.BackColor(base.GripLight); }
        }
        public override Color ImageMarginGradientBegin
        {
            get { return Table.BackColor(base.ImageMarginGradientBegin); }
        }
        public override Color ImageMarginGradientEnd
        {
            get { return Table.BackColor(base.ImageMarginGradientEnd); }
        }
        public override Color ImageMarginGradientMiddle
        {
            get { return Table.BackColor(base.ImageMarginGradientMiddle); }
        }
        public override Color ImageMarginRevealedGradientBegin
        {
            get { return Table.BackColor(base.ImageMarginRevealedGradientBegin); }
        }
        public override Color ImageMarginRevealedGradientEnd
        {
            get { return Table.BackColor(base.ImageMarginRevealedGradientEnd); }
        }
        public override Color ImageMarginRevealedGradientMiddle
        {
            get { return Table.BackColor(base.ImageMarginRevealedGradientMiddle); }
        }
        public override Color MenuBorder
        {
            get { return Table.BorderColor(base.MenuBorder); }
        }
        public override Color MenuItemBorder
        {
            get { return Table.BackColor(base.MenuItemBorder); }
        }
        public override Color MenuItemPressedGradientBegin
        {
            get { return Table.BackColorPressed(base.MenuItemPressedGradientBegin); }
        }
        public override Color MenuItemPressedGradientEnd
        {
            get { return Table.BackColorPressed(base.MenuItemPressedGradientEnd); }
        }
        public override Color MenuItemPressedGradientMiddle
        {
            get { return Table.BackColorPressed(base.MenuItemPressedGradientMiddle); }
        }
        public override Color MenuItemSelected
        {
            get { return Table.BackColorSelected(base.MenuItemSelected); }
        }
        public override Color MenuItemSelectedGradientBegin
        {
            get { return Table.BackColorSelected(base.MenuItemSelectedGradientBegin); }
        }
        public override Color MenuItemSelectedGradientEnd
        {
            get { return Table.BackColorSelected(base.MenuItemSelectedGradientEnd); }
        }
        public override Color MenuStripGradientBegin
        {
            get { return Table.BorderColor(base.MenuStripGradientBegin); }
        }
        public override Color MenuStripGradientEnd
        {
            get { return Table.BorderColor(base.MenuStripGradientEnd); }
        }
        public override Color OverflowButtonGradientBegin
        {
            get { return Table.BackColor(base.OverflowButtonGradientBegin); }
        }
        public override Color OverflowButtonGradientEnd
        {
            get { return Table.BackColor(base.OverflowButtonGradientEnd); }
        }
        public override Color OverflowButtonGradientMiddle
        {
            get { return Table.BackColor(base.OverflowButtonGradientMiddle); }
        }
        public override Color RaftingContainerGradientBegin
        {
            get { return Table.BorderColor(base.RaftingContainerGradientBegin); }
        }
        public override Color RaftingContainerGradientEnd
        {
            get { return Table.BorderColor(base.RaftingContainerGradientEnd); }
        }
        public override Color SeparatorDark
        {
            get { return Table.BorderColor(base.SeparatorDark); }
        }
        public override Color SeparatorLight
        {
            get { return Table.BorderColor(base.SeparatorLight); }
        }
        public override Color StatusStripGradientBegin
        {
            get { return Table.BackColor(base.StatusStripGradientBegin); }
        }
        public override Color StatusStripGradientEnd
        {
            get { return Table.BackColor(base.StatusStripGradientEnd); }
        }
        public override Color ToolStripBorder
        {
            get { return Table.BorderColor(base.ToolStripBorder); }
        }
        public override Color ToolStripContentPanelGradientBegin
        {
            get { return Table.BackColor(base.ToolStripContentPanelGradientBegin); }
        }
        public override Color ToolStripContentPanelGradientEnd
        {
            get { return Table.BackColor(base.ToolStripContentPanelGradientEnd); }
        }
        public override Color ToolStripDropDownBackground
        {
            get { return Table.BackColor(base.ToolStripDropDownBackground); }
        }
        public override Color ToolStripGradientBegin
        {
            get { return Table.BackColor(base.ToolStripGradientBegin); }
        }
        public override Color ToolStripGradientEnd
        {
            get { return Table.BackColor(base.ToolStripGradientEnd); }
        }
        public override Color ToolStripGradientMiddle
        {
            get { return Table.BackColor(base.ToolStripGradientMiddle); }
        }
        public override Color ToolStripPanelGradientBegin
        {
            get { return Table.BackColor(base.ToolStripPanelGradientBegin); }
        }
        public override Color ToolStripPanelGradientEnd
        {
            get { return Table.BackColor(base.ToolStripPanelGradientEnd); }
        }
    }
}
